package org.gnyxy.controller.background;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.gnyxy.dto.GenChartRequest;
import org.gnyxy.result.Result;
import org.gnyxy.service.ChartService;
import org.gnyxy.service.XfxhService;
import org.gnyxy.vo.ChartVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/background/aiChart")
@Slf4j
@Api(tags = "商家后台-AI生成图表相关接口")
public class ChartController {
    @Autowired
    private ChartService chartService;


    @ApiOperation("AI生成图表和结论")
    @PostMapping("/genByAI")
    public Result<ChartVO> generateResultByAI(@RequestPart("file") MultipartFile multipartFile,
                                              GenChartRequest chartRequest) {
        log.info("AI生成图表和结论: {}",chartRequest);
        return Result.success(chartService.generateResultByAI(multipartFile,chartRequest));
    }
}
